package com.lantosec.hmrp.modules.cms.entity;

import java.time.LocalDateTime;
import java.util.Date;

import com.lantosec.hmrp.core.mvc.BaseEntity;
import com.lantosec.hmrp.modules.cms.vo.CmsArticleVO;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;

/**
 * <p>
 * CMS文章列表 实体类
 * </p>
 *
 * @author AutoCode
 * @since 2020-07-06
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class CmsArticle extends BaseEntity<CmsArticleVO> {

    private static final long serialVersionUID = 1L;
    public CmsArticle(CmsArticleVO vo){
        this.articleId = vo.getArticleId();
        this.categoryId = vo.getCategoryId();
        this.articleName = vo.getArticleName();
        this.contentBrief = vo.getContentBrief();
        this.content = vo.getContent();
        this.issuer = vo.getIssuer();
        this.upFlag = vo.getUpFlag();
        this.editorId = vo.getEditorId();
        this.editorName = vo.getEditorName();
        this.editorTime = vo.getEditorTime();
        this.thumbnail = vo.getThumbnail();
        this.articleFlag = vo.getArticleFlag();
        this.weight = vo.getWeight();
    }

    @Override
    public CmsArticleVO convertToVO(){
        return new CmsArticleVO(this);
    }


    /**
     * 文章ID
     */
    @TableId(value = "article_id", type = IdType.AUTO)
    private Integer articleId;

    /**
     * 栏目ID
     */
    private String categoryId;

    /**
     * 文章名称
     */
    private String articleName;

    /**
     * 内容简介
     */
    private String contentBrief;

    /**
     * 内容
     */
    private String content;

    /**
     * 发布者
     */
    private String issuer;

    /**
     * 置顶标识
     */
    private Integer upFlag;

    /**
     * 编辑者ID
     */
    private String editorId;

    /**
     * 编辑者名称
     */
    private String editorName;

    /**
     * 编辑时间
     */
    private Date editorTime;

    /**
     * 缩略图
     */
    private String thumbnail;

    /**
     * 文章标识(1头条2热门3推荐)
     */
    private Integer articleFlag;

    /**
     * 权重(默认50)
     */
    private Integer weight;


    public enum ColName {
        article_id, category_id, article_name, content_brief, content, issuer, up_flag, editor_id, editor_name, editor_time, thumbnail, article_flag, weight,
    }
}
